﻿#pragma warning disable 649    // disable compiler warnings about unassigned fields

namespace ITSSP.Web.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data.Objects.DataClasses;
    using System.Linq;
    using System.Web.DomainServices;
    using System.Web.Ria;
    using System.Web.Ria.Services;


    // The MetadataTypeAttribute identifies UserMetadata as the class
    // that carries additional metadata for the User class.
    [MetadataTypeAttribute(typeof(User.UserMetadata))]
    public partial class User
    {
        internal sealed class UserMetadata
        {
            // Metadata classes are not meant to be instantiated.
            private UserMetadata()
            {
            }

            [Key]
            [ReadOnly(true)]
            [Display(Order=1, Name="ID", AutoGenerateField=false)]
            public int Id;

            [Key]
            [Required]
            [RegularExpression("[a-zA-Z0-9]+.[a-zA-Z0-9]+")]
            [Display(Order=4, Name="Login", AutoGenerateField=true)]
            public string Login;

            [Required]
            [Display(Order=2, Name="First Name", AutoGenerateField=true)]
            public string FirstName;

            [Required]
            [Display(Order=3, Name="Last Name", AutoGenerateField=true, AutoGenerateFilter=true)]
            public string LastName;

            [Required]
            [RegularExpression(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")]
            [Display(Order=5, Name="E-Mail", AutoGenerateField=true)]
            public string EMailAddress;

            [Required]
            [Display(Order=5, Name="Enabled", AutoGenerateField=true)]
            [DefaultValue(true)]
            public bool Enabled;

            [Required]
            [Display(AutoGenerateField=false, AutoGenerateFilter=false)]
            public bool ActiveDirectoryUser;

            [Display(AutoGenerateField=false, AutoGenerateFilter=false)]
            public String HashedPassword;

            [ReadOnly(true)]
            [Display(AutoGenerateField=false, AutoGenerateFilter=false)]
            public String FullName;

            public EntityCollection<Role> Roles;
        }
    }
}

#pragma warning restore 649    // re-enable compiler warnings about unassigned fields
